// /**
//  * Copyright © 2016 Magento. All rights reserved.
//  * See COPYING.txt for license details.
//  */

//
//  Yes/no switcher
//  _____________________________________________

//
//  Variables
//  ---------------------------------------------

@actions-switcher-speed: .2s;

@actions-switcher__background-color: @color-gray89;
@actions-switcher__border-radius: 12px;
@actions-switcher__border: 1px solid @color-gray65-lighten;
@actions-switcher__height: 22px;
@actions-switcher__width: 37px;

@actions-switcher-control__background-color: @color-white;

@actions-switcher-handler__background-color: @color-white;
@actions-switcher-handler__height: @actions-switcher__height;
@actions-switcher-handler__width: @actions-switcher__height;


.admin__actions-switch {
    display: inline-block;
    position: relative;
    vertical-align: middle;

    .admin__field-control & {
        line-height: @action__height;
    }
}

.admin__actions-switch-checkbox {
    &:extend(.abs-visually-hidden all);

    ._disabled &,
    &.disabled {
        + .admin__actions-switch-label {
            cursor: not-allowed;
            opacity: @disabled__opacity;
            pointer-events: none;
        }
    }

    &:checked {
        + .admin__actions-switch-label {
            &:before {
                left: (@actions-switcher__width - @actions-switcher-handler__width);
            }

            &:after {
                background: @color-green-apple;
            }

            .admin__actions-switch-text {
                &:before {
                    content: attr(data-text-on);
                }
            }
        }
    }

    &:focus {
        + .admin__actions-switch-label {
            &:before,
            &:after {
                border-color: @field-control__focus__border-color;
            }
        }
    }

    ._error & {
        + .admin__actions-switch-label {
            &:before,
            &:after {
                border-color: @field-error-control__border-color;
            }
        }
    }
}

.admin__actions-switch-label {
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-select: none;
    cursor: pointer;
    display: inline-block;
    height: @actions-switcher__height;
    line-height: @actions-switcher__height;
    position: relative;
    user-select: none;
    vertical-align: middle;

    &:before,
    &:after {
        left: 0;
        position: absolute;
        right: auto;
        top: 0;
    }

    &:before {
        background: @actions-switcher-handler__background-color;
        border-radius: 100%;
        border: @actions-switcher__border;
        content: '';
        display: block;
        height: @actions-switcher-handler__height;
        transition: left @actions-switcher-speed ease-in 0s;
        width: @actions-switcher-handler__width;
        z-index: 1;
    }

    &:after {
        background: @actions-switcher__background-color;
        border-radius: @actions-switcher__border-radius;
        border: @actions-switcher__border;
        content: '';
        display: block;
        height: @actions-switcher__height;
        transition: background @actions-switcher-speed ease-in 0s;
        vertical-align: middle;
        width: @actions-switcher__width;
        z-index: 0;
    }
}

.admin__actions-switch-text {
    &:before {
        content: attr(data-text-off);
        padding-left: (@actions-switcher__width + 10);
        white-space: nowrap;
    }
}
